<template>
	<div v-if="formState !== 'hidden'">
		<div class="container">
			<div class="container_title">
				<span>报销信息</span>
				<span>
					<el-button
						v-if="formState !== 'write'"
						type=""
						icon="el-icon-upload2"
						size="mini"
						@click="exportFile">
						导出
					</el-button>
				</span>
			</div>
			<div class="container_content">
				<div class="chunk_nav" v-if="formState !== 'readonly'">
					<div class="nav_item">
						<div class="label">报销类型：</div>
						<div class="content">
							<el-checkbox-group
								v-model="checkedMenu"
								:disabled="formState && formState !== 'write'"
								@change="checkedMenuChange">
								<div class="menu">
									<el-checkbox
										v-for="item in dicts.BusinessType"
										:key="item.index"
										:label="item.index">
										{{ item.value }}
									</el-checkbox>
								</div>
							</el-checkbox-group>
						</div>
					</div>
				</div>
				<div class="chunk_contentBox" v-if="notEmpty(menu)">
					<div
						v-for="item in menu"
						:key="item.value"
						:label="item.value"
						ref="chunk_contentBox"
						:class="[
							checkedMenu.includes(item.value) ? 'chunk_contentBox_actived' : '',
						]">
						<Chunk
							v-show="checkedMenu.includes(item.value)"
							v-model="item.data"
							:tableClounmOptions="item.tableClounmOptions"
							:status="formState || item.status"
							:title="item.title"
							:formData="infoData"
							:state="state"
							:type="type"
							:applyType="applyType"
							ref="chunk"></Chunk>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
	import { OrderParamOrderCarCode } from '@/api/finance/manage/collect/api.js';
	import * as apis from '@/api/finance/reimburs/add/api.js';
	import Chunk from '../chunk/index.vue';
	import * as regs from '@/utils/validator.js';

	export default {
		name: 'info',
		props: {
			value: {
				required: true,
			},
			state: {
				default: 'write',
			},
			type: {
				required: false,
			},
			formStatus: {
				required: false,
				default: '',
			},
			id: {
				required: false,
			},
			applyType: {
				required: false,
				default: '',
			},
		},
		components: { Chunk },
		dicts: [
			'expense_use_type',
			'expense_use_type_car',
			'expense_use_type_pay',
			'expense_use_type_transport',
			'expense_use_type_registration',
			'expense_use_type_other',
			'expense_use_type_gps',
			'expense_business_cleancar',
			'expense_business_fuel',
			'expense_business_stopcar',
			'expense_business_road',
			'expense_business_car',
			'expense_business_pay',
			'expense_business_transport',
			'expense_business_registration',
			'expense_business_inspect',
			'expense_business_gps',
			'expense_business_other',
			'expense_use_type_inspect',
			'car_nature',
			'car_classification',
			'fuel_type',
			'gps_device_type',
		],
		data() {
			return {
				checkedMenu: [],
				menu: [],
				dicts: {
					car_classification: [
						{
							label: '新车',
							value: '新车',
						},
						{
							label: '旧车',
							value: '旧车',
						},
					],
					// 收款人类型
					payeeTypeList: [
						{
							label: '员工',
							value: '1',
						},
						{
							label: '司机',
							value: '2',
						},
						{
							label: '供应商',
							value: '3',
						},
					],
					contractTypeList: [
						{
							label: '短租',
							value: '1',
						},
						{
							label: '渠道',
							value: '2',
						},
						{
							label: '自营',
							value: '3',
						},
						{
							label: '代收代付',
							value: '4',
						},
					],
					needpayType: [
						{
							label: '是',
							value: '1',
						},
						{
							label: '否',
							value: '2',
						},
					],
					BusinessType: [],
				},
				refs: {
					chunk: null,
				},
			};
		},
		computed: {
			infoData: {
				get() {
					return this.useVModel.call(this);
				},
				set(value) {
					this.$emit('input', value);
				},
			},
			formState: {
				get() {
					let state = 'write';
					if (!this.formStatus) {
						switch (this?.formStatus?.toString()) {
							case '0':
								state = 'write';
								break;
							case '1':
								state = 'disabled';
								break;
							case '2':
								state = 'hidden';
								break;
							default:
								state = this.state;
								break;
						}
					}
					return state;
				},
			},
		},
		watch: {
			value: {
				handler(val) {
					// console.log("watch infoData");
					if (this.infoData?.businessTypeVos?.length > 0) {
						this.formatValue();
					}
				},
				immediate: false,
				deep: true,
			},
			// menu: {
			// 	handler(val) {
			// 		// console.log("watch menu");
			// 		console.log(val);
			// 		// this.formatValue();
			// 	},
			// 	deep: true,
			// },
		},
		async mounted() {
			await this.getBusinessType();
			this.init();
			this.$emitter.on('reimburs_init', this.init);
		},

		methods: {
			async toDetails(row) {
				let reg = /DDCL.*/g;
				if (reg.test(row.orderId)) {
					this.$modal.loading('正在跳转中，请稍后...');
					let data3 = await this.getOrderCar(row.orderId);
					let route = {};
					if (this.notEmpty(data3)) {
						route = {
							name: 'SuborderDetail',
							query: {
								id: data3.orderCarId,
								orderCarCode: data3.orderCarCode,
								estimatedDeliveryTime: data3.estimatedDeliveryTime,
								orderId: data3.orderId,
							},
						};
					}
					if (this.notEmpty(route)) {
						this._toPage(route);
					}
					this.$modal.closeLoading();
				}
			},
			getOrderCar(orderCarId) {
				if (this.Empty(orderCarId)) return;
				return new Promise(resolve => {
					OrderParamOrderCarCode(orderCarId)
						.then(res => {
							if (res.code == 200) {
								resolve(res.data);
							} else {
								throw new Error(res);
							}
						})
						.catch(err => resolve());
				});
			},
			init() {
				this.checkedMenu = [];
				this.initMenu();
				this.menuBindDict();
				this.formatValue();
			},

			valid() {
				return new Promise(async resolve => {
					let result = true;
					let refs = Object.values(this.$refs);
					for (let index = 0; index < refs?.length; index++) {
						const ref = refs[index];
						if (Object.prototype.toString.call(ref) == '[object Array]') {
							for (let i = 0; i < ref.length; i++) {
								const element = ref[i];
								if (element?.valid) {
									let rc = await element?.valid?.();
									result = result && rc;
								}
								if (element?.validate) {
									let rf = await this._valid(ref);
									result = result && rf;
								}
								if (element?.form_validate) {
									let rf = await this._valid(ref, 'form_validate');
									result = result && rf;
								}
							}
						} else {
							if (ref?.valid) {
								let rc = await ref?.valid?.();
								result = result && rc;
							}
							if (ref?.validate) {
								let rf = await this._valid(ref);
								result = result && rf;
							}
							if (ref?.form_validate) {
								let rf = await this._valid(ref, 'form_validate');
								result = result && rf;
							}
						}
					}

					resolve(result);
				});
			},
			exportFile() {
				if (!this.infoData?.id) return;
				let params = {
					id: this.infoData?.id,
				};

				this.download(apis?.ExportFile, params, `报销信息_${new Date().getTime()}.xlsx`);
			},
			checkedMenuChange(id) {
				// console.log(this.menu);
				// console.log(this.infoData);
				this.setInitData(id);
			},
			setInitData(id) {
				// 新增
				this.checkedMenu.map(item => {
					let e = this.infoData?.businessTypeVos?.findIndex(e => {
						return item == e.businessType * 1;
					});
					if (e == -1) {
						this.infoData.businessTypeVos.push({
							businessType: item?.toString(),
							businessInfoVos: [
								{
									// companyName: this?.infoData?.companyName,
									// companyId: this?.infoData?.companyId,
									costType: '',
								},
							],
							invoiceUploadType: 1,
						});
					}
				});
				let item,
					index = -1;
				this.infoData?.businessTypeVos?.find((e, i) => {
					if (!this.checkedMenu.includes(e.businessType * 1)) {
						item = e;
						index = i;
					}
				});
				if (index !== -1) {
					this.infoData.businessTypeVos?.splice(index, 1);
					// this.infoData.businessTypeVos = [];
					let i = this.menu?.findIndex(e => e.value == item?.businessType);
					if (i !== -1) {
						this.menu[i].data.businessInfoVos = [];
					}
				}

				this.formatValue();
			},
			formatValue(data) {
				if (this.checkedMenu.length == 0) {
					this.infoData?.businessTypeVos?.map(item => {
						this.checkedMenu.push(item.businessType * 1);
					});
				}
				this.menu?.map(item => {
					let ele = null;
					this.infoData?.businessTypeVos?.map(e => {
						if (e.businessType == item.value) {
							ele = e;
						}
					});

					if (!!ele) {
						item.data = ele;
					}
				});
				// return this.menu;
			},

			menuBindDict() {
				this.dicts.BusinessType.map(item => {
					let child = this.menu.find(e => e.title === item.value);
					if (child) {
						this.$set(child, 'dictType', item.dictType);
						this.$set(child, 'value', item.index);
					}
				});
			},
			resetInvoice(item) {
				item.invoiceOssId = '';
				item.otherOssId = '';
				item.invoiceType = '';
				item.invoiceMoney = '';
				item.taxMoney = '';
				item.taxRate = '';
			},
			// 设置chunk需要的数据
			initItemData(key, data = {}) {
				let item = this.menu.find(item => {
					return item.value == key;
				});
				if (!item) return;
				item.data = data;
			},
			async getBusinessType() {
				return new Promise((resolve, reject) => {
					this.loading = true;
					let params = {};
					apis?.BusinessType(params)
						.then(res => {
							this.dicts.BusinessType = res.data;
						})
						.catch(err => {
							reject();
						})
						.finally(() => {
							this.loading = false;
							resolve();
						});
				});
			},
			getDateDuration(startTime, endTime) {
				let result = '-';
				let start = this.$dayjs(startTime);
				let end = this.$dayjs(endTime);
				let duration = this.$dayjs.duration(end.diff(start));
				let H_all = duration.as('hours');
				let D = parseInt(H_all / 24);
				let H = (H_all % 24).toFixed(1)?.split('.');
				if (D == 0) {
					result = `${H} 小时`;
				} else if ((H?.[0] == 0 && H?.[1] == 0) || (!H[0] && !H[1])) {
					result = `${D} 天`;
				} else if (H?.[1] == 0) {
					result = `${D} 天 ${H[0]} 小时`;
				} else {
					result = `${D} 天 ${H[0]}.${H[1]} 小时`;
				}
				return result;
			},

			// 初始化生成title和elTableColumn
			initMenu() {
				this.menu = [];
				this.menu.push(this.initMenu_Car());
				this.menu.push(this.initMenu_Resource());
				this.menu.push(this.initMenu_Stop());
				this.menu.push(this.initMenu_Road());
				this.menu.push(this.initMenu_CarServer());
				this.menu.push(this.initMenu_Recharge());
				this.menu.push(this.initMenu_Transoirt());
				this.menu.push(this.initMenu_License());
				this.menu.push(this.initMenu_Check());
				this.menu.push(this.initMenu_GPS());
				this.menu.push(this.initMenu_Other());
				this.menu.push(this.initMenu_Driver());
			},
			getFuelTypeLabel(fuelType) {
				let item = this.dict.type.fuel_type?.find(e => e.value === fuelType);
				if (item) {
					return item.label;
				}
				return undefined;
			},
			//车辆
			setCarData({ row, data }) {
				console.log(data);

				this.$set(row, 'companyId', data.ascriptionId);
				this.$set(row, 'companyName', data.ascription);
				this.$set(row, 'orderId', data.vinNo);
				this.$set(row, 'carCard', data.carNo); // 车牌号
				this.$set(row, 'carVin', data.vinNo); // 车架号
				this.$set(row, 'carType', data.carClassification); // 新车/旧车
				this.$set(row, 'carModel', data.modelName); // 车型
				this.$set(row, 'carTypes', this.getFuelTypeLabel(data.fuelType)); // 车辆类型
				this.$set(row, 'registType', data.carNature); // 登记类型
				// this.$set(row, "carFuelModel", data.fuelType); // 燃油型号
				this.$set(row, 'customUserName', data.customerName); // 客户
				this.$set(row, 'customerCode', data.customerCode); // 客户id
				this.$set(row, 'ncId', data.ncId); // nc
				this.setCarTypeState(data.carClassification ? 'readonly' : 'write');
			},
			//订单
			setOrderData({ row, data }) {
				let registType = this.dict.type.car_nature?.find(
					e => e.label === data.operationTypeStr,
				);
				this.$set(row, 'companyId', data.lessorId);
				this.$set(row, 'companyName', data.lessorName);
				this.$set(row, 'orderId', data.orderCarCode);
				this.$set(row, 'carCard', data.carPlateNo); // 车牌号
				this.$set(row, 'carVin', data.carVinNo); // 车架号
				this.$set(row, 'carType', data.carTypeStr); // 新车/旧车
				this.$set(row, 'carModel', data.carModelName); // 车型
				this.$set(row, 'carTypes', data.carPowerTypeStr); // 车辆类型
				this.$set(row, 'registType', registType?.value); // 登记类型
				// this.$set(row, "carFuelModel", data.); // 燃油型号
				this.$set(row, 'customUserName', data.leaseeName); // 客户
				this.$set(row, 'customerCode', data.customerCode); // 客户id
				this.$set(row, 'ncId', data.ncId); // nc
				this.setCarTypeState(data.carTypeStr ? 'readonly' : 'write');
			},
			initTableData({ row }) {
				this.$set(row, 'companyId', undefined);
				this.$set(row, 'companyName', undefined);
				this.$set(row, 'orderId', undefined);
				this.$set(row, 'carCard', undefined); // 车牌号
				this.$set(row, 'carVin', undefined); // 车架号
				this.$set(row, 'carType', undefined); // 新车/旧车
				this.$set(row, 'carModel', undefined); // 车型
				this.$set(row, 'carTypes', undefined); // 车辆类型
				this.$set(row, 'registType', undefined); // 登记类型
				// this.$set(row, "carFuelModel", data.); // 燃油型号
				this.$set(row, 'customUserName', undefined); // 客户
				this.$set(row, 'customerCode', undefined); // 客户id
				this.$set(row, 'ncId', undefined); // nc
				this.setCarTypeState(undefined ? 'readonly' : 'write');
			},
			setCarTypeState(state) {
				this.menu.forEach(item => {
					item.tableClounmOptions.forEach(e => {
						if (e.prop === 'carType') {
							this.$set(e, 'state', state);
						}
					});
				});
			},
			// 洗车
			initMenu_Car() {
				return {
					title: '洗车',
					status: 'write',
					data: {
						companyName: '',
					},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: true,
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							tag: 'readonlyEvent',
							prop: 'orderId',
							type: 'input',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							rules: true,
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: [
								{
									required: true,
									message: '请选择使用日期',
									trigger: 'change',
								},
							],
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectList: this?.dict?.type?.expense_business_cleancar ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},
						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},
						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: [
								{
									required: true,
									message: '请输入金额',
									trigger: 'blur',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: [
								{
									required: true,
									message: '请输入合同类型',
									trigger: 'change',
								},
							],
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						// {
						// 	label: '燃油型号',
						// 	prop: 'carFuelModel',
						// 	type: 'input_number',
						// 	prototype: {
						// 		step: 1,
						// 		stepStrictly: true,
						// 	},
						// 	// rules: true,
						// },
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],
							rules: [
								{
									required: true,
									message: '请输入办理用途',
									trigger: 'change',
								},
							],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',

							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},

			// 燃油&充电&加气
			initMenu_Resource() {
				return {
					title: '燃油&充电&加气',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							type: 'input',
							tag: 'readonlyEvent',
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: [
								{
									required: true,
									message: '请选择使用日期',
									trigger: 'change',
								},
							],
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectList: this?.dict?.type?.expense_business_fuel ?? [],
							rules: [
								{
									required: true,
									message: '请选择活动区域',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
							event: {
								type: 'change',
								cb: row => {
									if (row.costType !== '2') {
										this.$set(row, 'card', undefined);
										this.$set(row, 'residueMoney', undefined);
									}
								},
							},
						},
						{
							label: '卡号',
							prop: 'card',
							type: row => {
								if (row.costType == '2') {
									return 'input';
								} else {
									return 'text';
								}
							},
							rules: [
								{
									required: true,
									message: '请输入卡号',
									trigger: 'blur',
								},
								{
									pattern: regs.BANK_ACC_REG,
									message: '请输入正确银行卡卡号',
									trigger: 'blur',
								},
							],
						},
						{
							label: '剩余金额',
							prop: 'residueMoney',
							type: row => {
								if (row.costType == '2') {
									return 'input_number';
								} else {
									return 'text';
								}
							},
							tag: 'price',
						},
						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: [
								{
									required: true,
									message: '请输入金额',
									trigger: 'blur',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							status: 'readonly',
							rules: [
								{
									required: true,
									message: '请选择合同类型',
									trigger: 'change',
								},
							],
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],

							rules: [
								{
									required: true,
									message: '请选择办理用途',
									trigger: 'change',
								},
							],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: [
								{
									required: true,
									message: '请选择是否需要支付',
									trigger: 'change',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '加油量（升）',
							type: 'input_number',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							prop: 'addFuel',
							rules: [
								{
									required: true,
									message: '请输入加油量（升）',
									trigger: 'blur',
								},
							],
						},
						{
							label: '起始时间',
							type: 'datePicker',
							prop: 'startTime',
							minWidth: '200px',
							datePickerType: 'datetime',
							labelformat: 'yyyy-MM-dd HH:mm',

							rules: [
								{
									required: true,
									message: '请选择起始时间',
									trigger: 'change',
								},
							],
						},
						{
							label: '结束时间',
							type: 'datePicker',
							prop: 'endTime',
							minWidth: '200px',
							datePickerType: 'datetime',
							labelformat: 'yyyy-MM-dd HH:mm',
							pickerOptions: row => {
								let options = {
									disabledDate: time => {
										let pass = true;
										let timeF = this.$dayjs(time).format('YYYY-MM-DD');
										let endTimeF = this.$dayjs(row.startTime).format(
											'YYYY-MM-DD',
										);
										if (row.startTime) {
											let isAfter = this.$dayjs(timeF).isBefore(endTimeF);
											pass = isAfter;
										}

										return pass;
									},
								};
								return options;
							},

							rules: [
								{
									required: true,
									message: '请选择结束时间',
									trigger: 'change',
								},
							],
						},

						{
							label: '起始地点',
							type: 'input',
							prop: 'startAddress',
							rules: [
								{
									required: true,
									message: '请输入起始地点',
									trigger: 'blur',
								},
							],
						},
						{
							label: '结束地点',
							type: 'input',
							prop: 'endAddress',
							rules: [
								{
									required: true,
									message: '请输入结束地点',
									trigger: 'blur',
								},
							],
						},
						{
							label: '起始里程',
							type: 'input_number',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							prop: 'startMileage',
							rules: [
								{
									required: true,
									message: '请输入起始里程',
									trigger: 'blur',
								},
							],
						},
						{
							label: '结束里程',
							type: 'input_number',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							prop: 'stopMileage',
							rules: [
								{
									required: true,
									message: '请输入结束里程',
									trigger: 'blur',
								},
							],
						},
						{
							label: '使用里程',
							type: 'input_number',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							prop: 'useMileage',
							rules: [
								{
									required: true,
									message: '请输入使用里程',
									trigger: 'blur',
								},
							],
						},
						// {
						// 	label: '平均油耗（L）',
						// 	type: 'input_number',
						// 	prototype: {
						// 		step: 0.01,
						// 		stepStrictly: true,
						// 	},
						// 	prop: 'aveFuelCost',
						// 	rules: [
						// 		{
						// 			required: true,
						// 			message: '请输入平均油耗（L）',
						// 			trigger: 'blur',
						// 		},
						// 	],
						// },
					],
				};
			},

			// 停车
			initMenu_Stop() {
				return {
					title: '停车',
					status: 'write',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							type: 'input',
							tag: 'readonlyEvent',
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: [
								{
									required: true,
									message: '请选择使用日期',
									trigger: 'change',
								},
							],
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this?.dict?.type?.expense_business_stopcar ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: [
								{
									required: true,
									message: '请输入金额',
									trigger: 'blur',
								},
							],
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: [
								{
									required: true,
									message: '请选择合同类型',
									trigger: 'change',
								},
							],
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],

							rules: [
								{
									required: true,
									message: '请选择办理用途',
									trigger: 'change',
								},
							],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '起始时间',
							type: 'datePicker',
							prop: 'startTime',
							minWidth: '200px',
							datePickerType: 'datetime',
							labelformat: 'yyyy-MM-dd HH:mm',
							event: {
								type: 'change',
								cb: row => {
									if (row?.startTime && row?.endTime) {
										let duration = this.getDateDuration(
											row.startTime,
											row.endTime,
										);
										this.$set(row, 'stopTime', duration);
									}
								},
							},
							rules: [
								{
									required: true,
									message: '请选择起始时间',
									trigger: 'change',
								},
							],
						},
						{
							label: '结束时间',
							type: 'datePicker',
							prop: 'endTime',
							minWidth: '200px',
							datePickerType: 'datetime',
							labelformat: 'yyyy-MM-dd HH:mm',
							pickerOptions: row => {
								let options = {
									disabledDate: time => {
										let pass = true;
										let timeF = this.$dayjs(time).format('YYYY-MM-DD');
										let endTimeF = this.$dayjs(row.startTime).format(
											'YYYY-MM-DD',
										);
										if (row.startTime) {
											let isAfter = this.$dayjs(timeF).isBefore(endTimeF);
											pass = isAfter;
										}

										return pass;
									},
								};
								return options;
							},
							event: {
								type: 'change',
								cb: row => {
									if (row?.startTime && row?.endTime) {
										let duration = this.getDateDuration(
											row.startTime,
											row.endTime,
										);
										this.$set(row, 'stopTime', duration);
									}
								},
							},
							rules: [
								{
									required: true,
									message: '请选择结束时间',
									trigger: 'change',
								},
							],
						},
						{
							label: '停放时间',
							type: 'text',
							prop: 'stopTime',
						},

						{
							label: '起始地点',
							type: 'input',
							prop: 'startAddress',
							rules: [
								{
									required: true,
									message: '请输入起始地点',
									trigger: 'blur',
								},
							],
						},
						{
							label: '结束地点',
							type: 'input',
							prop: 'endAddress',
							rules: [
								{
									required: true,
									message: '请输入结束地点',
									trigger: 'blur',
								},
							],
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: [
								{
									required: true,
									message: '请选择是否需要支付',
									trigger: 'change',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// 路桥费
			initMenu_Road() {
				return {
					title: '路桥费',
					status: 'write',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({
										data,
										row,
										index,
										type,
									});
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},

							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							type: 'input',
							tag: 'readonlyEvent',
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: [
								{
									required: true,
									message: '请选择使用日期',
									trigger: 'change',
								},
							],
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this?.dict?.type?.expense_business_road ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: [
								{
									required: true,
									message: '请输入金额',
									trigger: 'blur',
								},
							],
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: [
								{
									required: true,
									message: '请选择合同类型',
									trigger: 'change',
								},
							],
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],

							rules: [
								{
									required: true,
									message: '请选择办理用途',
									trigger: 'change',
								},
							],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: [
								{
									required: true,
									message: '请选择是否需要支付',
									trigger: 'change',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},

						{
							label: '办公车牌',
							prop: 'workCarCard',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入办公车牌',
									trigger: 'blur',
								},
							],
						},
						{
							label: '起始时间',
							type: 'datePicker',
							prop: 'startTime',
							minWidth: '200px',
							datePickerType: 'datetime',
							labelformat: 'yyyy-MM-dd HH:mm',

							rules: [
								{
									required: true,
									message: '请选择起始时间',
									trigger: 'change',
								},
							],
						},
						{
							label: '结束时间',
							type: 'datePicker',
							prop: 'endTime',
							minWidth: '200px',
							datePickerType: 'datetime',
							labelformat: 'yyyy-MM-dd HH:mm',
							pickerOptions: row => {
								let options = {
									disabledDate: time => {
										let pass = true;
										let timeF = this.$dayjs(time).format('YYYY-MM-DD');
										let endTimeF = this.$dayjs(row.startTime).format(
											'YYYY-MM-DD',
										);
										if (row.startTime) {
											let isAfter = this.$dayjs(timeF).isBefore(endTimeF);
											pass = isAfter;
										}

										return pass;
									},
								};
								return options;
							},

							rules: [
								{
									required: true,
									message: '请选择结束时间',
									trigger: 'change',
								},
							],
						},
						{
							label: '起始地点',
							type: 'input',
							prop: 'startAddress',
							rules: [
								{
									required: true,
									message: '请输入起始地点',
									trigger: 'blur',
								},
							],
						},
						{
							label: '结束地点',
							type: 'input',
							prop: 'endAddress',
							rules: [
								{
									required: true,
									message: '请输入结束地点',
									trigger: 'blur',
								},
							],
						},
					],
				};
			},
			// 车务费用
			initMenu_CarServer() {
				return {
					title: '车务费用',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							type: 'input',
							tag: 'readonlyEvent',
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: [
								{
									required: true,
									message: '请选择使用日期',
									trigger: 'change',
								},
							],
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this.dict?.type?.expense_business_car ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: [
								{
									required: true,
									message: '请输入金额',
									trigger: 'blur',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: [
								{
									required: true,
									message: '请选择合同类型',
									trigger: 'change',
								},
							],
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type_car ?? [],

							rules: [
								{
									required: true,
									message: '请选择办理用途',
									trigger: 'change',
								},
							],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: [
								{
									required: true,
									message: '请选择是否需要支付',
									trigger: 'change',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// 充值费用
			initMenu_Recharge() {
				return {
					title: '充值费用',
					data: {},
					tableClounmOptions: [
						{
							label: '区分',
							type: 'select',
							prop: 'differenceType',
							selectList: [
								{
									label: '自用',
									value: '0',
								},
								{
									label: '客用',
									value: '1',
								},
							],
							rules: [
								{
									required: true,
									message: '请选择区分',
									trigger: 'change',
								},
							],
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							valueFormat: 'yyyy-MM-dd',
							datePickerType: 'date',
							rules: [
								{
									required: true,
									message: '请选择使用日期',
									trigger: 'change',
								},
							],
						},
						// {
						//     label: "使用人",
						//     type: "select_dialog",
						//     prop: "userName",
						//     propLabel: "orderId",
						//     select_dialog: {
						//         type: "user",
						//         title: "请选择使用人",
						//     },
						//     cb: (val) => {
						//         console.log(val);
						//     },
						// },
						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},
						{
							label: '充值类型',
							prop: 'costType',
							type: 'select',
							selectList: this.dict?.type?.expense_business_pay ?? [],
							rules: [
								{
									required: true,
									message: '请选择充值类型',
									trigger: 'change',
								},
							],
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',

							selectList: this.dict?.type?.expense_use_type_pay ?? [],
							rules: [
								{
									required: true,
									message: '请选择办理用途',
									trigger: 'change',
								},
							],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '卡号',
							prop: 'card',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入卡号',
									trigger: 'blur',
								},
								{
									pattern: regs.BANK_ACC_REG,
									message: '请输入正确银行卡卡号',
									trigger: 'blur',
								},
							],
						},
						{
							label: '充值金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: [
								{
									required: true,
									message: '请输入充值金额',
									trigger: 'blur',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: [
								{
									required: true,
									message: '请选择是否需要支付',
									trigger: 'change',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// 运输
			initMenu_Transoirt() {
				return {
					title: '运输',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							type: 'input',
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
							tag: 'readonlyEvent',
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: [
								{
									required: true,
									message: '请选择使用日期',
									trigger: 'change',
								},
							],
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this.dict?.type?.expense_business_transport ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							state: this.type === 'audit' ? 'readonly' : 'write',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: [
								{
									required: true,
									message: '请输入金额',
									trigger: 'blur',
								},
							],
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: [
								{
									required: true,
									message: '请选择合同类型',
									trigger: 'change',
								},
							],
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',

							selectList: this.dict?.type?.expense_use_type_transport ?? [],
							rules: [
								{
									required: true,
									message: '请选择办理用途',
									trigger: 'change',
								},
							],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},
						{
							label: '物流公司',
							prop: 'logisticsCompany',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入物流公司',
									trigger: 'blur',
								},
							],
						},
						{
							label: '起运时间',
							prop: 'startTransportTime',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: [
								{
									required: true,
									message: '请选择起运时间',
									trigger: 'change',
								},
							],
						},
						{
							label: '物流开始城市',
							prop: 'startLogisticsCity',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入物流开始城市',
									trigger: 'blur',
								},
							],
						},
						{
							label: '物流结束城市',
							prop: 'endLogisticsCity',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入物流结束城市',
									trigger: 'blur',
								},
							],
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: [
								{
									required: true,
									message: '请选择是否需要支付',
									trigger: 'change',
								},
							],
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// 上牌
			initMenu_License() {
				return {
					title: '上牌',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							type: 'input',
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
							tag: 'readonlyEvent',
							rules: [
								{
									required: true,
									message: '请选择订单/车辆',
									trigger: 'change',
								},
							],
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: true,
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this.dict?.type?.expense_business_registration ?? [],
							rules: true,
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: [
								{
									required: true,
									message: '请输入使用人',
									trigger: 'blur',
								},
							],
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							state: this.type === 'audit' ? 'readonly' : 'write',
							rules: [
								{
									required: true,
									message: '请输入金额',
									trigger: 'blur',
								},
							],
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: [
								{
									required: true,
									message: '请选择合同类型',
									trigger: 'change',
								},
							],
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							rules: true,
							selectList: this.dict?.type?.expense_use_type_registration ?? [],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// 年检
			initMenu_Check() {
				return {
					title: '年检',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: true,
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							type: 'input',
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
							tag: 'readonlyEvent',
							rules: true,
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: true,
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this.dict?.type?.expense_business_inspect ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: true,
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: true,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							rules: true,
							selectList: this.dict?.type?.expense_use_type_inspect ?? [],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// GPS
			initMenu_GPS() {
				return {
					title: 'GPS',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: true,
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'input',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
							tag: 'readonlyEvent',
							rules: true,
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: true,
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this.dict?.type?.expense_business_gps ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: true,
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: true,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},

						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},
						{
							label: 'GPS品牌',
							prop: 'gpsBrand',
							type: 'input',
							rules: true,
						},
						{
							label: '安装/续费产品',
							prop: 'installRenewProduct',
							type: 'select',
							selectList: this.dict?.type?.gps_device_type ?? [],
							rules: true,
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',

							selectList: this.dict?.type?.expense_use_type_gps ?? [],
							rules: true,
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// 其他费用&运行费
			initMenu_Other() {
				return {
					title: '其他费用&运行费',
					data: {},
					tableClounmOptions: [
						{
							show: this.formState !== 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'FinanceOrder,FinanceCar',
								title: '请选择订单/车辆',
								params: {
									_FinanceOrder: {
										// companyId: this.infoData?.companyId,
									},
									_FinanceCar: {
										//ascriptionId: this.infoData?.companyId,
									},
								},
							},
							// selectDialogValidate: row => {
							// 	if (!this.infoData?.companyId) {
							// 		this.$message({
							// 			message: '请选择所属公司',
							// 			type: 'warning',
							// 		});
							// 		return false;
							// 	}
							// 	return true;
							// },
							cb: (data, row, index, type) => {
								if (type == 'FinanceCar') {
									this.setCarData({ data, row, index, type });
								} else if (type == 'FinanceOrder') {
									this.setOrderData({
										data,
										row,
										index,
										type,
									});
								} else {
									this.initTableData({ row });
								}
							},
							rules: true,
						},
						{
							show: this.formState == 'readonly',
							label: '选择订单/车辆',
							prop: 'orderId',
							propLabel: 'orderId',
							type: 'input',
							className: orderId => {
								let reg = /DDCL.*/g;
								if (reg.test(orderId)) {
									return 'DDCL';
								}
							},
							event: {
								type: 'click',
								cb: row => {
									this.toDetails(row);
								},
							},
							tag: 'readonlyEvent',
							rules: true,
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
							format: row => {
								return row.infoCompanyName ?? row.companyName;
							},
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							minWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
							rules: true,
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',

							selectList: this.dict?.type?.expense_business_other ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
							rules: true,
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							rules: true,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'select',
							selectList: this.dicts.car_classification,
							state: 'readonly',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'input_number',
							prototype: {
								step: 1,
								stepStrictly: true,
							},
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'select',
							selectList: this.dict.type.car_nature,
							state: 'readonly',
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',

							selectList: this.dict?.type?.expense_use_type_other ?? [],
							rules: true,
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'input',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			// 司机费
			initMenu_Driver() {
				return {
					title: '司机费',
					data: {},
					tableClounmOptions: [
						// {
						//     label: "劳务公司",
						//     prop: "orderId",
						//     propLabel: "orderId",
						//     type: "select_dialog",
						//     select_dialog: {
						//         type: "company",
						//         title: "请选择劳务公司",
						//     },
						//     cb: (val) => {
						//         console.log(val);
						//     },
						// },
						{
							label: '劳务公司',
							prop: 'laborCompany',
							type: 'input',
							rules: true,
						},
						{
							label: '区分',
							type: 'select',
							prop: 'differenceType',
							selectList: [
								{
									label: '自用',
									value: '0',
								},
								{
									label: '客用',
									value: '1',
								},
							],
							rules: true,
						},
						{
							label: '上月人数',
							prop: 'lastMonthSum',
							type: 'input_number',
							watch: ({ row }) => {
								this.setDiffPeoper(row);
							},
							prototype: {
								step: 1,
								stepStrictly: true,
							},
							rules: true,
						},
						{
							label: '本月人数',
							prop: 'monthSum',
							type: 'input_number',
							watch: ({ row }) => {
								this.setDiffPeoper(row);
							},
							prototype: {
								step: 1,
								stepStrictly: true,
							},
							rules: true,
						},
						{
							label: '差异人数',
							prop: 'differenceSum',
						},
						{
							label: '上月金额',
							prop: 'lastMonthMoney',
							type: 'input_number',
							watch: ({ row }) => {
								this.setDiffMoney(row);
							},
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							tag: 'price',
							rules: true,
						},

						{
							label: '本月金额',
							prop: 'monthMoney',
							type: 'input_number',
							prototype: {
								step: 0.01,
								stepStrictly: true,
							},
							watch: ({ row }) => {
								this.setDiffMoney(row);
							},
							tag: 'price',
							rules: true,
						},

						{
							label: '差异金额',
							prop: 'differenceMoney',
							tag: 'price',
						},
						{
							label: '差异原因',
							prop: 'differenceReason',
							type: 'input',
						},
						{
							label: '对外支付金额（元）',
							prop: 'money',
							type: 'input_number',
							tag: 'price',
							state: this.type === 'audit' ? 'readonly' : 'write',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
							minRows: 1,
							maxRows: 1,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
							rules: true,
							state: this.type === 'audit' ? 'readonly' : 'write',
						},
					],
				};
			},
			setDiffPeoper(row) {
				if (
					Number.isFinite(Number(row.lastMonthSum)) &&
					Number.isFinite(Number(row.monthSum))
				) {
					let price = Math.abs(
						this.numberSub(Number(row.lastMonthSum), Number(row.monthSum)),
					);
					this.$set(row, 'differenceSum', price);
				}
			},
			setDiffMoney(row) {
				if (
					Number.isFinite(Number(row.lastMonthMoney)) &&
					Number.isFinite(Number(row.monthMoney))
				) {
					let price = Math.abs(
						this.numberSub(Number(row.lastMonthMoney), Number(row.monthMoney)),
					);
					this.$set(row, 'differenceMoney', price);
				}
			},
		},
	};
</script>
<style lang="scss" scoped>
	.container {
		border-radius: 10px;
		background-color: #fff;
		// margin: 20px;
		padding: 20px;
		.container_title {
			margin-bottom: 30px;
			border-bottom: 1px solid #e9e9e9;
			font-weight: 600;
			display: flex;
			justify-content: space-between;
			padding-bottom: 15px;
			font-family: PingFangSC, PingFang SC;
			font-weight: 500;
			font-size: 16px;
			color: #333333;
			line-height: 22px;
			text-align: left;
			font-style: normal;
		}
		.container_content {
			// padding: 2rem;
		}
	}
	.chunk_nav {
		background-color: #fff;
		// padding: 2rem 0;
		.nav_item {
			padding-bottom: 30px;
			// display: flex;
			.label {
				box-sizing: border-box;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 14px;
				color: #464646;
				line-height: 22px;
				text-align: left;
				font-style: normal;
				text-transform: none;
				padding-bottom: 10px;
			}
			.content {
				flex: 1;
				min-width: 0;
				.menu {
					width: 100%;
					// display: grid;
					// grid-template-columns: repeat(6, minmax(0, 1fr));
					gap: 15px 0;
					display: flex;
					flex-wrap: wrap;
				}
			}
		}
	}
	.chunk_contentBox {
		background-color: #fff;

		// padding: 2.5rem;
		.chunk_contentBox_actived {
			margin-bottom: 50px;
		}
		.chunk_contentBox_actived:last-child {
			margin: 0;
		}
	}
	NaNpxakeBox {
		display: flex;
		margin-bottom: 20px;
		.label {
			font-size: 14px;
			margin-right: 15px;
		}
		.content {
			width: 370px;
		}
	}
	.handleBox {
		display: flex;
		justify-content: center;
	}
	::v-deep .gridBox {
		padding-top: 0;
	}
	.component-fade-enter, .component-fade-leave-to
/* .component-fade-leave-active for below version 2.1.8 */ {
		transform: translateX(100px);
		opacity: 0;
	}

	.component-fade-enter-active,
	.component-fade-leave-active {
		transition: all 0.8s;
	}
	::v-deep .DDCL {
		color: #409eff;
		cursor: pointer;
	}
</style>
